def Goods_List():
    with open("goods.txt", 'r', encoding="utf-8") as f:
        message = f.readlines()
    for i in message:
        print(i)

def Like_Select():
    with open("goods.txt", 'r', encoding="utf-8") as f:
        message = f.readlines()
    for i in message:
        if key in i:
            print(i)

def Goods_Add():
    print("""**********欢迎使用xx商城购物系统*********""")
    name = input("请输入商品名:")
    price = input("请输入商品价格:")
    num = input("请输入商品数量:")
    with open("goods.txt", 'a', encoding="utf-8") as f:
        f.write(" ".join([name,price,num]))

print("""
**********欢迎使用xx商城购物x系统*********
1.商品管理
2.会员管理（不可选，正在开发中)
""")

while True:
    DATA = int(input("请输入选项："))
    if DATA == 1:
        print(
"""
**********欢迎使用xx商城购物x系统*********
1.查看商品列表
2.根据关键字搜索指定商品（不可选，正在开发中)
3.录入商品
"""
        )
        while True:
            DATA_1 = int(input("查看商品列表："))
            if DATA_1 == 1:
                Goods_List()

            elif DATA_1 == 2:
                print("""**********欢迎使用xx商城购物系统*********""")
                key = input("请输入查询的关键字:")
                if key == "N":
                    continue
                Like_Select()

            elif DATA_1 == 3:
                Goods_Add()
            else:
                print("输入不正确，请重新输入")
                continue

    elif DATA == 2:
        print("此功能不可用，正在开发中,请重新选择")
        continue

    else:
        print("您输入的不正确，请重新输入:")
